#define DEBUG
#include <cstdio>
#define MAXN 100000
#define MAXLOGN 17

using namespace std;

class Graph {
public:
  int n, m, ind[MAXN+1], to[2*MAXN-1], link[2*MAXN-1], dfn[MAXN+1], dfs[MAXN+1], fa[MAXN+1][MAXLOGN+1];
  bool node[MAXN+1];

  void addSide(int x, int y) {
    m++;
    to[m]=y;
    link[m]=ind[x];
    ind[x]=m;
  }

  void build(int o, int fa) {
    for (int i=ind[o]; i; i=link[i]) {
      if (to[i]!=fa) {
	build(to[i], o);
      }
    }
    
    dfn[o]=++dfn[0];
    dfs[dfn[o]]=o;
    this->fa[o][0]=fa;
  }

  void initFa() {
    for (int j=1; j<=MAXLOGN; j++) {
      for (int i=1; i<=n; i++) {
	fa[i][j] = fa[fa[i][j-1]][j-1];
      }
    }
  }
};

class Heap {
public:
  int key[MAXN+1], val[MAXN+1];
  
  bool cmp(int x, int y) {
    return key[x]<=key[y];
  }

  void swap(int x, int y) {
    int temp;
    temp=key[x], key[x]=key[y], key[y]=temp;
    temp=val[x], val[x]=val[y], val[y]=temp;
  }

  void up(int o) {
    if (o>1 && cmp(o, o/2)) {
      swap(o, o/2);
      up(o/2);
    }
  }

  void down(int o) {
    if ((((o*2<key[0]) && cmp(o*2, o*2+1)) || (o*2==key[0])) && cmp(o*2, o)) {
      swap(o*2, o);
      down(o*2);
    } else if ((o*2<key[0] && cmp(o*2+1, o*2)) && cmp(o*2+1, o)) {
      swap(o*2+1, o);
      down(o*2+1);
    }
  }

  void ins(int k, int v) {
    key[++key[0]]=k;
    val[key[0]]=v;
    up(key[0]);
  }

  void del() {
    val[1]=val[key[0]];
    key[1]=key[key[0]--];
    down(1);
  }
};

void sortSide(int a[][2], int l, int r) {
  int i=l, j=r, mid=a[(l+r)/2][1], temp;
  for (; i<=j; ) {
    for (; a[j][1]>mid; j--);
    for (; a[i][1]<mid; i++);
    if (i<=j) {
      temp=a[i][0], a[i][0]=a[j][0], a[j][0]=temp;
      temp=a[i][1], a[i][1]=a[j][1], a[j][1]=temp;
      i++, j--;
    }
  }
  if (i<r) {
    sortSide(a, i, r);
  }
  if (j>l) {
    sortSide(a, l, j);
  }
}

int op1(Graph *g, Heap *h) {
  int ret=h->val[1];
  g->node[ret]=true;
  h->del();
  return ret;
}

int op2(int x, Graph *g, Heap *h) {
  int ret=0;
  for (int i=MAXLOGN; i>=0; i--) {
    if (g->node[g->fa[x][i]]) {
      x = g->fa[x][i];
      ret += 1<<i;
    }
  }
  g->node[x]=false;
  h->ins(g->dfn[x], x);
  return ret;
}

int main() {
#ifdef DEBUG
  freopen("4811.in", "r", stdin);
  freopen("4811.out", "w", stdout);
#endif

  static Graph g;
  static Heap h;
  static int side[2*MAXN-1][2];
  int n, t;
  scanf("%d %d", &n, &t);
  g.n=n;
  
  for (int i=1; i<n; i++) {
    scanf("%d %d", side[i*2-1], side[i*2-1]+1);
    side[i*2][0]=side[i*2-1][1], side[i*2][1]=side[i*2-1][0];
  }
  sortSide(side, 1, 2*n-2);
  for (int i=2*n-2; i>0; i--) {
    g.addSide(side[i][0], side[i][1]);
  }
  g.build(1, 0);
  g.initFa();

  for (int i=1; i<=n; i++) {
    h.key[i]=i;
    h.val[i]=g.dfs[i];
  }
  h.key[0]=n;
 
  for (int i=1; i<=t; i++) {
    int op, x;
    scanf("%d %d", &op, &x);
    if (op==1) {
      for (int i=1; i<x; i++) {
	op1(&g, &h);
      }
    }
    printf("%d\n", op==1 ? op1(&g, &h) : op2(x, &g, &h));
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
